home *** CD-ROM | disk | FTP | other *** search
/ Macademic for Students & Teachers / Macademic for Students and Teachers (Quantum Leap)(1992).iso / Fun & Games / CoreWar / Rattlesnake < prev    next >
Text File  |  1987-04-05  |  2KB  |  89 lines

  1. * Rattlesnake (A hopping vampire)
  2. * Ames Cornish[76214,435] -- 4/3/87
  3. *
  4. * Rattlesnake regularly defeats the Five Musketeers,
  5. * Smart Vampire, and even the Worm.
  6. *
  7. * To give the other side a chance, I strongly suggest
  8. * that you load the fighters into RANDOM locations.
  9. *
  10. * Rattlesnake consists of two coroutines: a fang placing
  11. * routine and a replicating routine.  The fang placing 
  12. * uses the standard Vampire algorithm (almost), the
  13. * replicating routine allows Rattlesnake to "hop" over
  14. * most attacks.  It also checks its new home for integrity
  15. * before relocating.
  16. *
  17. * Have fun!!
  18. *
  19. @-7
  20. FIRST   dat  333
  21. *
  22. * Trap routine:
  23. *
  24. HITS    dat  500                 ;HAVE WE CAUGHT ANYONE?
  25. SPIN    spl  0                   ;HERE'S OUR TRAP
  26.         djz  NULL,HITS
  27.            jmp  -2
  28. NULL    mov     1,SPIN
  29.         jmp  0
  30. *
  31. *
  32. @0
  33. START   mov  #-4000,BITE
  34.         spl     DUP
  35. *
  36. * Vampire (fang-placing) routine:
  37. *
  38. PLACE   mov  #(SPIN-BITE),@BITE  ;PLACE FANGS IN MEMORY
  39.         sub  BITE,@BITE
  40.         sub  #1,BITE
  41.         mov  FANG,@BITE
  42.         sub  #7,BITE
  43.         jmp  PLACE
  44. *
  45. BITE    dat  0
  46. FANG       jmp  @1
  47. *
  48. * Replicating (hopping) routine:
  49. *
  50. DUP     mov  DIST,TO               ;Replicate program
  51.         sub  #(TO-FIRST),TO
  52.         mov  #(FIRST-FROM),FROM
  53. DLP1                mov  @FROM,@TO
  54.         cmp  FROM,#(LAST-FROM)
  55.         jmp  CHK
  56.         add  #1,FROM
  57.         add  #1,TO
  58.         jmp  DLP1
  59. *
  60. CHK                 cmp  FIRST-2100,#333       ;Is new copy OK?
  61.         jmp  2
  62.         jmp  DUP
  63.         cmp  LAST-2100,#333
  64.         jmp  2
  65.         jmp  DUP                   ;If not OK, reduplicate
  66. *
  67. HOP     cmp  HITS,#500             ;CAUGHT ANYONE?
  68.         jmp  2
  69.         jmp  WIPE                  ;If so, wipe memory
  70.         mov  RELOC,SPIN            ;SEND VAMPIRE AND TRAPPED
  71.         mov  #0,PLACE              ;ROUTINES TO NEW LOCATIONS
  72.         jmp  START-2100
  73. *
  74. DIST       dat  -2100                 ;How far to hop
  75. RELOC   jmp  -2100                 ;Relocation instruction
  76. FROM    dat  0                     ;Source for copy
  77. TO      dat  0                     ;Destination for copy
  78. ZERO    dat  LAST-7999             ;Destination for "bombs"
  79. *
  80. * Routine to clear memory:
  81. *
  82. WIPE    mov  #0,PLACE              ;KILL VAMPIRE ROUTINE, AND
  83.         mov  #0,@ZERO              ;FILL MEMORY WITH ZEROES
  84.         add  #1,ZERO
  85.                        cmp  ZERO,#(WIPE-ZERO)     ;finished wipe?
  86.         jmp  0                     ;if so, then wait.
  87.         jmp  -4
  88. *
  89. LAST    dat  333